﻿using PosClient.Delegates;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PosClient.Controls
{
    public partial class NumberKeyboard : UserControl
    {
        public event KeyboardEventHandler KeyboardEvent;
        public NumberKeyboard()
        {
            InitializeComponent();
            InitEvnet();
        }

        private void InitEvnet()
        {
            button0.Click += Button_Click;
            button00.Click += Button_Click;
            button000.Click += Button_Click;
            button1.Click += Button_Click;
            button2.Click += Button_Click;
            button3.Click += Button_Click;
            button4.Click += Button_Click;
            button5.Click += Button_Click;
            button6.Click += Button_Click;
            button7.Click += Button_Click;
            button8.Click += Button_Click;
            button9.Click += Button_Click;
            button10.Click += Button_Click;
            button20.Click += Button_Click;
            button50.Click += Button_Click;
            buttonDot.Click += Button_Click;
            buttonEnter.Click += Button_Click;
            buttonBACKSPACE.Click += Button_Click;
        }

        private void Button_Click(object sender, EventArgs e)
        {
            var button = (sender as AntdUI.Button);
            KeyboardEvent?.Invoke(button.Name.Substring(6,button.Name.Length - 6), e);
        }

    }
}
